it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
=== Configuration changes in 1.16 ===
-
+* $wgScriptModifiedMsgCheck Checks the mediawiki namespace recent changes to
+ensure a updated urid for script-loader
+* $wgScriptModifiedCheck Checks script file modified time for unique request id)
+* $wgEnableAsyncDownload (lets you disable Async download for windows.
+Hopefully we will remove this configuration var soon)
* $wgEnableFirefogg enable support for firefogg extension, firefogg supports
in-browser transcoding, chunk uploads and client side hash checking.
* $wgEnableTemporalOggUrls enable oggz_chop support a server side ogg seeking
*
* and or you can update $wgStyleVersion
*/
-$wgScriptModifiedCheck = true;
+$wgScriptModifiedFileCheck = true;
+
+/*
+ * $wgScriptModifiedMsgCheck Checks MediaWiki NS for latest
+ * Revision for generating the request id.
+ *
+ */
+$wgScriptModifiedMsgCheck = true;
/*
* enable js2 Script System
var $mParseWarnings = array();
var $mSquidMaxage = 0;
var $mRevisionId = null;
+ var $mScriptLoader = null;
protected $mTitle = null;
/**
}
$this->addScript( Html::linkedScript( $path . "?" . $this->getURIDparam( $js_class ) ) );
- //merge in language text (if js2 is on and we have loadGM function)
+ // Merge in language text (if js2 is on and we have loadGM function & scriptLoader is "off")
if( $wgEnableJS2system ){
- $inlineMsg = jsScriptLoader::getInlineLoadGMFromClass( $js_class );
+ if( !$this->mScriptLoader )
+ $this->mScriptLoader = new jsScriptLoader();
+
+ $inlineMsg = $this->mScriptLoader->getInlineLoadGMFromClass( $js_class );
if( $inlineMsg != '' )
$this->addScript( Html::inlineScript( $inlineMsg ));
}
* Get the unique request ID parameter for the script-loader request
*/
function getURIDparam( $classAry = array() ) {
- global $wgDebugJavaScript, $wgStyleVersion, $IP, $wgScriptModifiedCheck;
- global $wgContLanguageCode;
+ global $wgDebugJavaScript, $wgStyleVersion, $IP, $wgScriptModifiedFileCheck;
+ global $wgLang, $wgScriptModifiedMsgCheck;
+ //Always the language key param to keep urls distinct per language
+ $uriParam = 'uselang=' . $wgLang->getCode();
if( $wgDebugJavaScript ) {
- return 'urid=' . time();
+ return $uriParam . '&urid=' . time();
} else {
//support single class_name attr
if( gettype( $classAry) == 'string' ){
}
$ftime = $frev = 0;
foreach( $classAry as $class ) {
- if( $wgScriptModifiedCheck ) {
- $js_path = jsScriptLoader::getJsPathFromClass( $class );
- if( $js_path ) {
- $cur_ftime = filemtime ( $IP ."/". $js_path );
- if( $cur_ftime > $ftime )
- $ftime = $cur_ftime;
- }
- }
// Add the latest revision ID if the class set includes a WT (wiki title)
if( substr($class, 0, 3) == 'WT:'){
$title_str = substr($class, 3);
if( $t->getLatestRevID() > $frev )
$frev = $t->getLatestRevID();
}
+ }else{
+ //check for file modified time:
+ if( $wgScriptModifiedFileCheck ) {
+ $js_path = jsScriptLoader::getJsPathFromClass( $class );
+ if( $js_path ) {
+ $cur_ftime = filemtime ( $IP ."/". $js_path );
+ if( $cur_ftime > $ftime )
+ $ftime = $cur_ftime;
+ }
+ }
}
}
//build the actual unique request id:
- $urid = "urid={$wgStyleVersion}";
+ $uriParam = "&urid={$wgStyleVersion}";
// Add the file modification time if set
if( $ftime != 0 )
- $urid .= "_" . $ftime;
+ $uriParam .= "_" . $ftime;
//add the wiki rev id if set
if( $frev != 0 )
- $urid.= "_" . $frev;
-
-
- //Always the language key param to keep urls distinct per language
- $urid.='&lang='.$wgContLanguageCode;
-
- return $urid;
+ $uriParam.= "_" . $frev;
+
+ //add the latest msg rev id if $wgScriptModifiedMsgCheck is enabled:
+ if( $wgScriptModifiedMsgCheck ){
+ $dbr = wfGetDB( DB_SLAVE );
+ // Grab the latest mediaWiki msg rev id:
+ $res = $dbr->select( 'recentchanges',
+ 'rc_id',
+ array( 'rc_namespace'=> NS_MEDIAWIKI ),
+ __METHOD__,
+ array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => 1 ,
+ 'USE INDEX' => array('recentchanges' => 'rc_timestamp' )
+ )
+ );
+ if( $dbr->numRows($res) != 0){
+ $rc = $dbr->fetchObject( $res );
+ if( $rc->rc_id ){
+ $uriParam.= '_' . $rc->rc_id;
+ }
+ }
+ //@@todo we could otherwise use the the SVN version if not already covered by $wgStyleVersion above
+ }
+ return $uriParam;
}
}
-
/**
* Given a script path, get the JS class name, or false if no such path is registered.
* @param $path string
$this->sFileCache->getCacheFileName();
// Setup script loader header info
+ // @@todo we might want to put these into the $mw var per class request set
+ // and or include a callback to avoid pulling in old browsers that don't support
+ // the onLoad attribute for script elements.
$this->jsout .= 'var mwSlScript = "' . $_SERVER['SCRIPT_NAME'] . '";' . "\n";
$this->jsout .= 'var mwSlGenISODate = "' . date( 'c' ) . '";' . "\n";
$this->jsout .= 'var mwSlURID = "' . htmlspecialchars( $this->urid ) . '";' . "\n";
// Swap in the appropriate language per js_file
foreach ( $this->jsFileList as $classKey => $file_name ) {
- // Special case: title classes
- if ( substr( $classKey, 0, 3 ) == 'WT:' ) {
- global $wgUser;
- // Get just the title part
- $title_block = substr( $classKey, 3 );
- if ( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ) {
- // Special case of "-" title with skin
- $parts = explode( '|', $title_block );
- $title = array_shift( $parts );
- foreach ( $parts as $tparam ) {
- list( $key, $val ) = explode( '=', $tparam );
- if ( $key == 'useskin' ) {
- $skin = $val;
- }
- }
- $sk = $wgUser->getSkin();
- // Make sure the skin name is valid
- $skinNames = Skin::getSkinNames();
- $skinNames = array_keys( $skinNames );
- if ( in_array( strtolower( $skin ), $skinNames ) ) {
- $this->jsout .= $sk->generateUserJs( $skin ) . "\n";
- // success
- continue;
- }
- } else {
- // Make sure the wiki title ends with .js
- if ( substr( $title_block, - 3 ) != '.js' ) {
- $this->error_msg .= 'WikiTitle includes should end with .js';
- continue;
- }
- // It's a wiki title, append the output of the wikitext:
- $t = Title::newFromText( $title_block );
- $a = new Article( $t );
- // Only get the content if the page is not empty:
- if ( $a->getID() !== 0 ) {
- $this->jsout .= $a->getContent() . "\n";
- }
- continue;
- }
- }
-
- // Dealing with files
-
- // Check that the filename ends with .js and does not include ../ traversing
- if ( substr( $file_name, - 3 ) != '.js' ) {
- $this->error_msg .= "\nError file name must end with .js: " . htmlspecialchars( $file_name ) . " \n ";
- continue;
- }
- if ( strpos( $file_name, '../' ) !== false ) {
- $this->error_msg .= "\nError file name must not traverse paths: " . htmlspecialchars( $file_name ) . " \n ";
- continue;
- }
-
- if ( trim( $file_name ) != '' ) {
- // If in debug mode, add a comment with the file name
- if ( $this->debug )
- $this->jsout .= "\n/**
-* File: " . htmlspecialchars( $file_name ) . "
-*/\n";
- $this->jsout .= ( $this->doProcessJsFile( $file_name ) ) . "\n";
+ //get the script content
+ $jstxt = $this->getScriptText($classKey, $file_name);
+ if( $jstxt ){
+ $this->jsout .= $this->doProcessJs( $jstxt );
}
}
-
- // Check if we should minify
+ // Check if we should minify the whole thing:
if ( !$this->debug ) {
// do the minification and output
$this->jsout = JSMin::minify( $this->jsout );
}
// Check for an error msg
if ( $this->error_msg != '' ) {
+ //just set the content type (don't send cache header)
+ header( 'Content-Type: text/javascript' );
echo 'alert(\'Error With ScriptLoader.php ::' . str_replace( "\n", '\'+"\n"+' . "\n'", $this->error_msg ) . '\');';
echo trim( $this->jsout );
} else {
- // All good, let's output "cache forever" headers
+ // All good, let's output "cache" headers
$this->outputJsWithHeaders();
}
}
+ function getScriptText($classKey, $file_name=''){
+ $jsout = '';
+ // Special case: title classes
+ if ( substr( $classKey, 0, 3 ) == 'WT:' ) {
+ global $wgUser;
+ // Get just the title part
+ $title_block = substr( $classKey, 3 );
+ if ( $title_block[0] == '-' && strpos( $title_block, '|' ) !== false ) {
+ // Special case of "-" title with skin
+ $parts = explode( '|', $title_block );
+ $title = array_shift( $parts );
+ foreach ( $parts as $tparam ) {
+ list( $key, $val ) = explode( '=', $tparam );
+ if ( $key == 'useskin' ) {
+ $skin = $val;
+ }
+ }
+ $sk = $wgUser->getSkin();
+ // Make sure the skin name is valid
+ $skinNames = Skin::getSkinNames();
+ $skinNames = array_keys( $skinNames );
+ if ( in_array( strtolower( $skin ), $skinNames ) ) {
+ // If in debug mode, add a comment with wiki title and rev:
+ if ( $this->debug )
+ $jsout .= "\n/**\n* GenerateUserJs: \n*/\n";
+ return $jsout . $sk->generateUserJs( $skin ) . "\n";
+ }
+ } else {
+ // Make sure the wiki title ends with .js
+ if ( substr( $title_block, - 3 ) != '.js' ) {
+ $this->error_msg .= 'WikiTitle includes should end with .js';
+ return false;
+ }
+ // It's a wiki title, append the output of the wikitext:
+ $t = Title::newFromText( $title_block );
+ $a = new Article( $t );
+ // Only get the content if the page is not empty:
+ if ( $a->getID() !== 0 ) {
+ // If in debug mode, add a comment with wiki title and rev:
+ if ( $this->debug )
+ $jsout .= "\n/**\n* WikiJSPage: " . htmlspecialchars( $title_block ) . " rev: " . $a->getID() . " \n*/\n";
+
+ return $jsout . $a->getContent() . "\n";
+ }
+ }
+ }else{
+ // Dealing with files
+
+ // Check that the filename ends with .js and does not include ../ traversing
+ if ( substr( $file_name, - 3 ) != '.js' ) {
+ $this->error_msg .= "\nError file name must end with .js: " . htmlspecialchars( $file_name ) . " \n ";
+ return false;
+ }
+ if ( strpos( $file_name, '../' ) !== false ) {
+ $this->error_msg .= "\nError file name must not traverse paths: " . htmlspecialchars( $file_name ) . " \n ";
+ return false;
+ }
+ if ( trim( $file_name ) != '' ) {
+ if ( $this->debug )
+ $jsout .= "\n/**\n* File: " . htmlspecialchars( $file_name ) . "\n*/\n";
+
+ $jsFileStr = $this->doGetJsFile( $file_name ) . "\n";
+ if( $jsFileStr ){
+ return $jsout . $jsFileStr;
+ }else{
+ $this->error_msg .= "\nError could not read file: ". htmlspecialchars( $file_name ) ."\n";
+ return false;
+ }
+ }
+ }
+ //if we did not return some js
+ $this->error_msg .= "\nUnknown error\n";
+ return false;
+ }
function outputJsHeaders() {
// Output JS MIME type:
header( 'Content-Type: text/javascript' );
}
//get the language code (if not provided use the "default" language
- if ( isset( $_GET['lang'] ) && $_GET['lang'] != '' ) {
+ if ( isset( $_GET['uselang'] ) && $_GET['uselang'] != '' ) {
//make sure its a valid lang code:
- $this->langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['lang']);
+ $this->langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['uselang']);
}else{
//set english as default
$this->langCode = 'en';
}
}
/**
- * Pre-process request variables without configuration to get a rKey for cache file check
+ * Pre-process request variables ~without configuration~ or much utility function~
+ * This is to quickly get a rKey that we can check against the cache
*/
function preProcRequestVars() {
$rKey = '';
}
//get the language code (if not provided use the "default" language
- if ( isset( $_GET['lang'] ) && $_GET['lang'] != '' ) {
+ if ( isset( $_GET['uselang'] ) && $_GET['uselang'] != '' ) {
//make sure its a valid lang code:
- $langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['lang']);
+ $langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['uselang']);
}else{
//set english as default
$langCode = 'en';
return false;
}
}
- function doProcessJsFile( $file_path ) {
- global $IP, $wgEnableScriptLocalization, $IP;
+ function doGetJsFile( $file_path ) {
+ global $IP;
// Load the file
$str = @file_get_contents( "{$IP}/{$file_path}" );
if ( $str === false ) {
// @@todo check PHP error level. Don't want to expose paths if errors are hidden.
$this->error_msg .= 'Requested File: ' . htmlspecialchars( $file_path ) . ' could not be read' . "\n";
- return '';
+ return false;
}
+ return $str;
+ }
+ function doProcessJs( $str ){
+ global $wgEnableScriptLocalization;
// Strip out js_log debug lines. Not much luck with this regExp yet:
// if( !$this->debug )
// $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
- // Do language swap
+ // Do language swap by index:
if ( $wgEnableScriptLocalization ){
$inx = self::getLoadGmIndex( $str );
if($inx){
return substr($str, 0, $inx['s']-1) . $translated . substr($str, $inx['e']+1);
}
}
+ //return the js str unmodified if we did not transform with the localization.
return $str;
}
static public function getLoadGmIndex( $str ){
}
}
- static public function getInlineLoadGMFromClass( $class ){
- global $IP;
- $file_path = self::getJsPathFromClass( $class );
- $str = @file_get_contents( "{$IP}/{$file_path}" );
-
- $inx = self::getLoadGmIndex( $str );
- if(!$inx)
- return '';
- $jsmsg = FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true);
+ function getInlineLoadGMFromClass( $class ){
+ $jsmsg = $this->getMsgKeysFromClass( $class );
if( $jsmsg ){
self::getMsgKeys ( $jsmsg );
- return 'loadGM('. FormatJson::encode( $jsmsg ) . ')';
+ return 'loadGM(' . FormatJson::encode( $jsmsg ) . ');';
}else{
//if could not parse return empty string:
return '';
}
}
+ function getMsgKeysFromClass( $class ){
+ $file_path = self::getJsPathFromClass( $class );
+ $str = $this->getScriptText($class, $file_path);
+
+ $inx = self::getLoadGmIndex( $str );
+ if(!$inx)
+ return '';
+ return FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true);
+ }
+
static public function getMsgKeys(& $jmsg, $langCode = false){
global $wgContLanguageCode;
if(!$langCode)
"mwe-file-thumbnail-no" : "The filename begins with <b><tt>$1<\/tt><\/b>",
"mwe-go-to-resource" : "Go to resource page",
"mwe-upload-misc-error" : "Unknown upload error",
- "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Firefogg#Supported_File_Types\">more information<\/a>).",
- "mwe-cancel-button" : "Cancel",
- "mwe-ok-button" : "OK"
+ "mwe-wgfogg_warning_bad_extension" : "You have selected a file with an unsuported extension (<a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Firefogg#Supported_File_Types\">more information<\/a>)."
});
var default_bui_options = {
}else{
//@@todo should fix jquery ui to not use object keys as user msg's
var bObj = {};
- bObj[ gM('mwe-ok-button') ] = function(){
+ bObj[ gM('mwe-ok') ] = function(){
$j(this).dialog('close');
};
$j('#upProgressDialog').dialog('option','buttons', bObj);
cancel_button:function(){
var _this = this;
var cancelBtn = new Array();
- cancelBtn[ gM('mwe-cancel-button') ] = function(){
+ cancelBtn[ gM('mwe-cancel') ] = function(){
return _this.cancel_action(this)
};
return cancelBtn;
'checked':1,
'title' :'Upload'
}
+ },
+ //some default layout values:
+ thumb_width : 80,
+ image_edit_width : 400,
+ video_edit_width : 400,
+ insert_text_pos : 0, //insert at the start (will be overwritten by the user cursor pos)
+ result_display_mode : 'box', //box or list
+
+ cUpLoader : null,
+ cEdit : null,
+ proxySetupDone : null,
+ dmodalCss : {},
+
+ init: function( options ){
+ var _this = this;
+ js_log('remoteSearchDriver:init');
+
+ //merge in the options:
+ //@@todo for cleaner config we should set _this.opt to the provided options)
+ $j.extend( _this, default_remote_search_options, options);
+
+ //update the base text:
+ if(_this.target_textbox)
+ _this.getTexboxSelection();
+
+ //modify the content provider config based on options:
+ if(_this.enabled_cps != 'all'){
+ for(var i in this.content_providers){
+ if( $j.inArray(i, _this.enabled_cps) != -1 ){
+ this.content_providers[i].enabled = true;
+ }else{
+ this.content_providers[i].enabled = false;
+ }
+ }
+ }
+ //set the upload target name if unset
+ if( _this.upload_api_target == 'local' && ! _this.upload_api_name && typeof wgSiteName != 'undefined')
+ _this.upload_api_name = wgSiteName;
+
+ //if the upload_api_proxy_frame is set _this.upload_api_target to "proxy"
+ if( _this.upload_api_proxy_frame )
+ _this.upload_api_target = 'proxy';
+
+ //map "local" to the local api
+ if( _this.upload_api_target == 'local' ){
+ if( ! _this.local_wiki_api_url ){
+ $j('#tab-upload').html( gM( 'rsd_config_error', 'missing_local_api_url' ) );
+ return false;
+ }else{
+ _this.upload_api_target = _this.local_wiki_api_url;
+ }
+ }
+
+ //set up the target invocation:
+ if( $j( this.target_invocation ).length==0 ){
+ js_log("RemoteSearchDriver:: no target invocation provided (will have to run your own doInitDisplay() )");
+ }else{
+ if( this.target_invocation ){
+ $j(this.target_invocation).css('cursor','pointer').attr('title', gM('mwe-add_media_wizard')).click(function(){
+ _this.doInitDisplay();
+ });
+ }
+ }
},
//define the licenses
// ... this will get complicated quick...
- // (just look at complexity for creative commons without exessive "duplicate data")
+ // (just look at complexity for creative commons without excessive "duplicate data")
// ie cc_by could be "by/3.0/us/" or "by/2.1/jp/" to infinitum...
- // some complexity should be negated by license equivalances.
+ // some complexity should be negated by license equivalences.
// but we will have to abstract into another class let content providers provide license urls
// and we have to clone the license object and allow local overrides
typestr +
'</div>'
},
- //some default layout values:
- thumb_width : 80,
- image_edit_width : 400,
- video_edit_width : 400,
- insert_text_pos : 0, //insert at the start (will be overwritten by the user cursor pos)
- result_display_mode : 'box', //box or list
-
- cUpLoader : null,
- cEdit : null,
- proxySetupDone : null,
- dmodalCss : {},
-
- init: function( options ){
- var _this = this;
- js_log('remoteSearchDriver:init');
-
- //merge in the options:
- //@@todo for cleaner config we should set _this.opt to the provided options)
- $j.extend( _this, default_remote_search_options, options);
-
- //update the base text:
- if(_this.target_textbox)
- _this.getTexboxSelection();
-
- //modify the content provider config based on options:
- if(_this.enabled_cps != 'all'){
- for(var i in this.content_providers){
- if( $j.inArray(i, _this.enabled_cps) != -1 ){
- this.content_providers[i].enabled = true;
- }else{
- this.content_providers[i].enabled = false;
- }
- }
- }
- //set the upload target name if unset
- if( _this.upload_api_target == 'local' && ! _this.upload_api_name && typeof wgSiteName != 'undefined')
- _this.upload_api_name = wgSiteName;
-
- //if the upload_api_proxy_frame is set _this.upload_api_target to "proxy"
- if( _this.upload_api_proxy_frame )
- _this.upload_api_target = 'proxy';
-
- //map "local" to the local api
- if( _this.upload_api_target == 'local' ){
- if( ! _this.local_wiki_api_url ){
- $j('#tab-upload').html( gM( 'rsd_config_error', 'missing_local_api_url' ) );
- return false;
- }else{
- _this.upload_api_target = _this.local_wiki_api_url;
- }
- }
-
- //set up the target invocation:
- if( $j( this.target_invocation ).length==0 ){
- js_log("RemoteSearchDriver:: no target invocation provided (will have to run your own doInitDisplay() )");
- }else{
- if( this.target_invocation ){
- $j(this.target_invocation).css('cursor','pointer').attr('title', gM('mwe-add_media_wizard')).click(function(){
- _this.doInitDisplay();
- });
- }
- }
- },
doInitDisplay:function(){
var _this = this;
//setup the parent container:
//js_log('added target id:' + $j(_this.target_container).attr('id'));
//get layout
js_log( 'width: ' + $j(window).width() + ' height: ' + $j(window).height());
- var cConf = {};
- cConf['cancel'] = function(){
+ var cBtn = {};
+ cBtn[ gM('mwe-cancel') ] = function(){
_this.cancelClipEditCB();
- }
+ }
function doResize(){
js_log('do resize:: ' + _this.target_container);
$j( '#rsd_modal_target').dialog('option', 'width', $j(window).width()-50 );
modal: true,
draggable:false,
resizable:false,
- buttons:cConf,
+ buttons:cBtn,
close: function() {
//if we are 'editing' a item close that
//@@todo maybe prompt the user?
});
- //re add cancel button
+ //add cancel callback and updated button with icon
_this.cancelClipEditCB();
//update the child position: (some of this should be pushed up-stream via dialog config options
$j( _this.target_container ).dialog( 'option', 'title', gM('mwe-add_media_wizard'));
js_log("should update: " + b_target + ' with: cancel');
//restore the buttons:
- $j(b_target).html( $j.btnHtml( 'Cancel' , 'mv_cancel_rsd', 'close'))
+ $j(b_target).html( $j.btnHtml( gM('mwe-cancel') , 'mv_cancel_rsd', 'close'))
.children('.mv_cancel_rsd')
.btnBind()
.click(function(){
"mwe-upload" : "Upload file",
"mwe-destfilename" : "Destination filename:",
"mwe-summary" : "Summary",
- "mwe-error_not_loggedin" : "You do not appear to be logged in or do not have upload privileges."
+ "mwe-error_not_loggedin" : "You do not appear to be logged in or do not have upload privileges.",
+ "mwe-watch-this-file" : "Watch this file",
+ "mwe-ignore-any-warnings" : "Ignore any warnings"
});
var default_form_options = {
'<textarea id="wpUploadDescription" cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>'+
'<input type="checkbox" value="true" id="wpWatchthis" name="watch" tabindex="7"/>'+
- '<label for="wpWatchthis">Watch this file</label>'+
+ '<label for="wpWatchthis">'+ gM('mwe-watch-this-file') +'</label>'+
'<input type="checkbox" value="true" id="wpIgnoreWarning" name="ignorewarnings" tabindex="8"/>'+
- '<label for="wpIgnoreWarning">Ignore any warnings</label></br>'+
+ '<label for="wpIgnoreWarning">' + gM('mwe-ignore-any-warnings') + '</label></br>'+
'<div id="wpDestFile-warning"></div>' +
- '<div style="clear:both;"></div>' +
+ '<div style="clear:both;"></div>' +'<p>' +
gM('mwe-select_ownwork') + '<br>' +
- '<input type="checkbox" id="wpLicence" name="wpLicence" value="cc-by-sa">' + gM('mwe-licence_cc-by-sa') + '<br>' +
+ '<input type="checkbox" id="wpLicence" name="wpLicence" value="cc-by-sa">' + gM('mwe-licence_cc-by-sa') + '</p>' +
'<input type="submit" accesskey="s" value="' + gM('mwe-upload') + '" name="wpUploadBtn" id="wpUploadBtn" tabindex="9"/>' +
//close the form and div
"mwe-set_in_out_points" : "Set in-out points",
"mwe-start_time" : "Start time",
"mwe-end_time" : "End time",
- "mwe-preview_inout" : "Preview in-out points"
+ "mwe-preview_inout" : "Preview in-out points",
+ "mwe-edit-tools" : "Edit tools",
+ "mwe-inline-description" : "Inline Description",
+ "mwe-edit-video-tools" : "Edit Video Tools:"
});
var default_clipedit_values = {
var eb = $j('#embed_vid').get(0);
//turn on preview to avoid onDone actions
eb.preview_mode = true;
- $j('#'+this.control_ct).html('<h3>Edit Video Tools:</h3>');
+ $j('#'+this.control_ct).html('<h3>' + gM('mwe-edit-video-tools') + '</h3>');
if( eb.supportsURLTimeEncoding() ){
$j('#'+this.control_ct).append(
_this.getSetInOutHtml({
$j.btnHtml( gM('mwe-preview_inout'), 'inOutPreviewClip', 'video');
},
getInsertDescHtml:function(){
- var o= '<h3>Inline Description</h3>'+
+ var o= '<h3>' + gM('mwe-inline-description') + '</h3>'+
'<textarea style="width:95%" id="mv_inline_img_desc" rows="5" cols="30">';
if( this.p_rsdObj ){
//if we have a parent remote search driver let it parse the inline description
var $tool_target = $j('#'+this.control_ct);
//by default apply Crop tool
if( _this.enabled_tools == 'all' || _this.enabled_tools.length > 0){
- $tool_target.append( '<h3>Edit tools</h3>' );
+ $tool_target.append( '<h3>'+ gM('mwe-edit-tools') +'</h3>' );
for( var i in _this.toolset ){
var toolid = _this.toolset[i];
if( $j.inArray( toolid, _this.enabled_tools) != -1 || _this.enabled_tools=='all')
"mwe-setting-up-proxy" : "Setting up proxy...",
"mwe-re-try" : "Retry API request",
"mwe-re-trying" : "Retrying API request...",
- "mwe-cancel" : "Cancel",
"mwe-proxy-not-ready" : "Proxy is not configured",
"mwe-please-login" : "You are not <a target=\"_new\" href=\"$1\">logged in<\/a> on $2 or mwEmbed has not been enabled. Resolve the issue, and then retry the request.",
"mwe-remember-loging" : "General security reminder: Only login to web sites when your address bar displays that site's address."
'</span>'+
'<input id="seq_save_summary" tabindex="1" maxlength="200" value="" size="30" name="seq_save_summary"/>'+
'</div>');
+ var bConf = {};
+ bConf[ gM('mwe-cancel') ] = function(){
+ $j(this).dialog('close');
+ };
+ bConf[ gm('mwe-edit_save') ] = function(){
+ var saveReq = {
+ 'action' : 'edit',
+ 'title' : _this.plObj.mTitle,
+ //the text is the sequence XML + the description
+ 'text' : _this.getSeqOutputHLRDXML() + "\n" +
+ _this.plObj.wikiDesc,
+ 'token' : _this.sequenceEditToken,
+ 'summary' : $j('#seq_save_summary').val()
+ };
+ //change to progress bar and save:
+ $j('#seq_save_dialog').html('<div class="progress" /><br>' +
+ gM('mwe-saving_wait')
+ )
+ $j('#seq_save_dialog .progress').progressbar({
+ value: 100
+ });
+ //run the Seq Save Request:
+ do_api_req( {
+ 'data': saveReq,
+ 'url' : _this.getLocalApiUrl()
+ },function(data){
+ $j('#seq_save_dialog').html( gM('mwe-save_done') );
+ $j('#seq_save_dialog').dialog('option',
+ 'buttons', {
+ "Done":function(){
+ //refresh the page?
+ window.location.reload();
+ },
+ "Do More Edits": function() {
+ $j(this).dialog("close");
+ }
+ });
+ });
+ };
//dialog:
$j('#seq_save_dialog').dialog({
bgiframe: true,
autoOpen: true,
modal: true,
- buttons:{
- "Save":function(){
- var saveReq = {
- 'action' : 'edit',
- 'title' : _this.plObj.mTitle,
- //the text is the sequence XML + the description
- 'text' : _this.getSeqOutputHLRDXML() + "\n" +
- _this.plObj.wikiDesc,
- 'token' : _this.sequenceEditToken,
- 'summary' : $j('#seq_save_summary').val()
- };
- //change to progress bar and save:
- $j('#seq_save_dialog').html('<div class="progress" /><br>' +
- gM('mwe-saving_wait')
- )
- $j('#seq_save_dialog .progress').progressbar({
- value: 100
- });
- //run the Seq Save Request:
- do_api_req( {
- 'data': saveReq,
- 'url' : _this.getLocalApiUrl()
- },function(data){
- $j('#seq_save_dialog').html( gM('mwe-save_done') );
- $j('#seq_save_dialog').dialog('option',
- 'buttons', {
- "Done":function(){
- //refresh the page?
- window.location.reload();
- },
- "Do More Edits": function() {
- $j(this).dialog("close");
- }
- });
- });
- },
- "Cancel":function(){
- $j(this).dialog('close');
- }
- }
+ buttons: bConf
});
})
},
js_log('type:' + _this.rObj['type']);
$j(appendTarget).html(gM('mwe-loading_txt'));
//@@todo integrate into core and loading system:
- loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/editor.js?' + getMvUniqueReqId() );
- loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMvUniqueReqId() );
- loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/ui.js?' + getMvUniqueReqId() );
- loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/uidata.js?' + getMvUniqueReqId() );
- loadExternalCss(mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMvUniqueReqId() );
+ loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/editor.js?' + getMwReqParam() );
+ loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
+ loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/ui.js?' + getMwReqParam() );
+ loadExternalJs(mv_embed_path + 'libClipEdit/pixastic-editor/uidata.js?' + getMwReqParam() );
+ loadExternalCss(mv_embed_path + 'libClipEdit/pixastic-editor/pixastic.all.js?' + getMwReqParam() );
var isPixasticReady = function(){
if(typeof PixasticEditor != 'undefined'){
//open up a new target_contaienr:
if( $j('#seq_resource_import').length == 0 )
$j('body').append('<div id="seq_resource_import" style="position:relative"></div>');
-
+ var bConf = {};
+ bConf[ gM( 'mwe-cancel' ) ] = function() {
+ $j(this).dialog("close");
+ }
$j('#seq_resource_import').dialog('destroy').dialog({
bgiframe: true,
width:750,
height:480,
modal: true,
- buttons: {
- "Cancel": function() {
- $j(this).dialog("close");
- }
- }
+ buttons: bConf
});
_this.target_container = '#seq_resource_import';
//do parent resource edit (with updated target)
"mwe-loading-add-media-wiz" : "Loading add media wizard",
"mwe-apiproxy-setup" : "Setting up API proxy",
"mwe-load-drag-item" : "Loading dragged item",
- "mwe-ok" : "OK"
+ "mwe-ok" : "OK",
+ "mwe-cancel" : "Cancel"
});
// Get the loading image
function mv_get_loading_img( style, class_attr ){
var style_txt = (style)?style:'';
- var class_attr = (class_attr)?'class="'+class_attr+'"':'class="mv_loading_img"';
+ var class_attr = (class_attr) ? 'class="' + class_attr + '"' : 'class="mv_loading_img"';
return '<div '+class_attr+' style="' + style +'"></div>';
}
}else{
var scriptPath = puri.path;
}
- //js_log('scriptServer Path is: ' + scriptPath + "\n host script path:" + getMvEmbedURL() );
- var dbug_attr = ( puri.queryKey['debug'] ) ? '&debug=true' : '';
+ //js_log('scriptServer Path is: ' + scriptPath + "\n host script path:" + getMvEmbedURL() );
this.libs[ last_class ] = scriptPath + '?class=' + class_set +
- '&urid=' + getMvUniqueReqId() + dbug_attr;
+ '&' + getMwReqParam();
} else {
// Do many requests
// Do a direct load of the file (pass along unique request id from
// request or mv_embed Version )
var qmark = (libLoc.indexOf( '?' ) !== true) ? '?' : '&';
- this.libs[curLib] = mv_embed_path + libLoc + qmark + 'urid=' + getMvUniqueReqId();
+ this.libs[curLib] = mv_embed_path + libLoc + qmark + getMwReqParam();
}
}
}
}
if( url.indexOf('?') == -1 ) {
- url += '?' + getMvUniqueReqId();
+ url += '?' + getMwReqParam();
}
if( !styleSheetPresent( url ) ) {
js_log( 'load css: ' + url );
return false;
}
// Get a unique request ID to ensure fresh JavaScript
-function getMvUniqueReqId() {
- if( _global['urid'] )
- return _global['urid'];
+function getMwReqParam() {
+ if( _global['req_param'] )
+ return _global['req_param'];
var mv_embed_url = getMvEmbedURL();
- // If we have a URI, return it
- var urid = parseUri( mv_embed_url ).queryKey['urid']
- if( urid ) {
- _global['urid'] = urid;
- return urid;
- }
- // If we're in debug mode, get a fresh unique request key
- if( parseUri( mv_embed_url ).queryKey['debug'] == 'true' ) {
+
+ var req_param = '';
+
+ // If we have a URI, add it to the req
+ var urid = parseUri( mv_embed_url ).queryKey['urid']
+ // If we're in debug mode, get a fresh unique request key and pass on "debug" param
+ if( parseUri( mv_embed_url ).queryKey['debug'] == 'true' ){
var d = new Date();
- var urid = d.getTime();
- _global['urid'] = urid;
- return urid;
+ req_param += 'urid=' + d.getTime() + '&debug=true';
+ }else if( urid ) {
+ // Set from request urid:
+ req_param += 'urid=' + urid;
+ }else{
+ // Otherwise, just use the mv_embed version
+ req_param += 'urid=' + $mw.version;
}
- // Otherwise, just return the mv_embed version
- return $mw.version;
+ //add the lang param:
+ var langKey = parseUri( mv_embed_url ).queryKey['uselang'];
+ if( langKey )
+ req_param += '&uselang=' + langKey;
+
+ _global['req_param'] = req_param;
+
+ return _global['req_param'];
}
/*
* Set the global mv_embed path based on the script's location
'mwe-start_time' => 'Start time',
'mwe-end_time' => 'End time',
'mwe-preview_inout' => 'Preview in-out points',
+ 'mwe-edit-tools' => 'Edit tools',
+ 'mwe-inline-description' => 'Inline Description',
+ 'mwe-edit-video-tools' => 'Edit Video Tools:',
/*
* js file: /libTimedText/mvTextInterface.js
'mwe-apiproxy-setup' => 'Setting up API proxy',
'mwe-load-drag-item' => 'Loading dragged item',
'mwe-ok' => 'OK',
+ 'mwe-cancel' => 'Cancel',
/*
* js file: /libMwApi/mw.proxy.js
'mwe-setting-up-proxy' => 'Setting up proxy...',
'mwe-re-try' => 'Retry API request',
'mwe-re-trying' => 'Retrying API request...',
- 'mwe-cancel' => 'Cancel',
'mwe-proxy-not-ready' => 'Proxy is not configured',
'mwe-please-login' => 'You are not <a target="_new" href="$1">logged in</a> on $2 or mwEmbed has not been enabled. Resolve the issue, and then retry the request.',
'mwe-remember-loging' => 'General security reminder: Only login to web sites when your address bar displays that site\'s address.',
'mwe-destfilename' => 'Destination filename:',
'mwe-summary' => 'Summary',
'mwe-error_not_loggedin' => 'You do not appear to be logged in or do not have upload privileges.',
+ 'mwe-watch-this-file' => 'Watch this file',
+ 'mwe-ignore-any-warnings' => 'Ignore any warnings',
/*
* js file: /libAddMedia/mvBaseUploadInterface.js
'mwe-go-to-resource' => 'Go to resource page',
'mwe-upload-misc-error' => 'Unknown upload error',
'mwe-wgfogg_warning_bad_extension' => 'You have selected a file with an unsuported extension (<a href="http://commons.wikimedia.org/wiki/Commons:Firefogg#Supported_File_Types">more information</a>).',
- 'mwe-cancel-button' => 'Cancel',
- 'mwe-ok-button' => 'OK',
/*
* js file: /libEmbedVideo/embedVideo.js
$j.each(langSet, function(na, langKey){
js_log('load language key: ' + langKey);
//do a manual call to the script-lodaer:
- js_log('do load: ' + '../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&lang='+langKey );
- $j.getScript('../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&lang='+langKey, function(){
+ js_log('do load: ' + '../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey );
+ $j.getScript('../../../mwScriptLoader.php?class=$mw.testLang&urid='+ scriptLoaderURID +'&uselang='+langKey, function(){
var o='';
o+='<tr><td colspan="6" height="20" style="font-size:large"><b>Lang:' + langKey + '</b></td></tr>';
//now for each langage msg:
var urlparts = getRemoteEmbedPath();
var mwEmbedHostPath = urlparts[0];
var reqAguments = urlparts[1];
+
addOnloadHook( function(){
//only do rewrites if MV_EMBED / js2 is "off"
if( typeof MV_EMBED_VERSION == 'undefined' ) {
});
}
-
// OggHandler rewrite for view pages:
var vidIdList = [];
var divs = document.getElementsByTagName( 'div' );